#!/bin/sh /etc/rc.common
# Example script
# Copyright (C) 2007 OpenWrt.org

 START=99
 STOP=99

DAEMON_PATH="/usr/bin/"


DAEMON=ddserver
DAEMONOPTS=""

NAME=ddserver
DESC="DslrDashboard Server"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

start() {
  echo start
        cd $DAEMON_PATH
        PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
        echo "Saving PID" $PID " to " $PIDFILE
        if [ -z $PID ]; then
          printf "%s\n" "Fail"
        else
          echo $PID > $PIDFILE
          printf "%s\n" "Ok"
        fi
}

stop() {
    echo stop
    PID=`cat $PIDFILE`
    cd $DAEMON_PATH
    if [ -f $PIDFILE ]; then
      kill -HUP $PID
      printf "%s\n" "Ok"
      rm -f $PIDFILE
    else
      printf "%s\n" "pidfile not found"
    fi
}

